/**************************************************************************************************
* Title: SmurfsRenderObject.cpp
* Authors: Gael Huber
* Description: Wrapper class for a render object
**************************************************************************************************/
#include "SmurfsMesh.h"

// Constructor
Mesh::Mesh(void) : data(0), screenCoords(Vector3(0,0,0)), angle(0.0f), dimensions(Vector3(0.5f,0.5f,0.5f)),
	halfDimensions(Vector3(0.25f,0.25f,0.25f)), rotationAxis(Vector3(1.0f,1.0f,1.0f)), resourceID(-1), objectID(-1) {
	// Do nothing
}

// Constructor
Mesh::Mesh(MeshType shape) : data(0), screenCoords(Vector3(0,0,0)), angle(0.0f), dimensions(Vector3(0.5f,0.5f,0.5f)),
	halfDimensions(Vector3(0.25f,0.25f,0.25f)), rotationAxis(Vector3(1.0f,1.0f,1.0f)), resourceID(-1), objectID(-1) {
	type = shape;

	// Set to draw a pyramid
	if(type == PYRAMID) {
		colors.push_back(Vector3(0.0f,1.0f,0.0f));			// Set The Color To Green
		vertices.push_back(Vector3( 0.0f, 0.25f, 0.0f));			// Top Of Triangle (Front)
		colors.push_back(Vector3(0.0f,1.0f,0.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f, 0.25f));		// Left Of Triangle (Front)
		colors.push_back(Vector3(0.0f,1.0f,0.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f, 0.25f));		// Right Of Triangle (Front)

		colors.push_back(Vector3(1.0f,0.5f,0.0f));			// Set The Color To Orange
		vertices.push_back(Vector3( 0.0f, 0.25f, 0.0f));			// Top Of Triangle (Right)
		colors.push_back(Vector3(1.0f,0.5f,0.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f, 0.25f));		// Left Of Triangle (Right)
		colors.push_back(Vector3(1.0f,0.5f,0.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f, -0.25f));		// Right Of Triangle (Right)

		colors.push_back(Vector3(0.0f,0.0f,1.0f));			// Set The Color To Blue
		vertices.push_back(Vector3( 0.0f, 0.25f, 0.0f));			// Top Of Triangle (Back)
		colors.push_back(Vector3(0.0f,0.0f,1.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f, -0.25f));		// Left Of Triangle (Back)
		colors.push_back(Vector3(0.0f,0.0f,1.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f, -0.25f));		// Right Of Triangle (Back)

		colors.push_back(Vector3(1.0f,0.0f,1.0f));			// Set The Color To Violet
		vertices.push_back(Vector3( 0.0f, 0.25f, 0.0f));			// Top Of Triangle (Left)
		colors.push_back(Vector3(1.0f,0.0f,1.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f,-0.25f));		// Left Of Triangle (Left)
		colors.push_back(Vector3(1.0f,0.0f,1.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f, 0.25f));		// Right Of Triangle (Left)

		colors.push_back(Vector3(1.0f,1.0f,0.0f));			// Set The Color To Yeller
		vertices.push_back(Vector3(-0.25, -0.25f, -0.25));			// Top Of Triangle (Bottom)
		colors.push_back(Vector3(1.0f,1.0f,0.0f));
		vertices.push_back(Vector3(0.25f,-0.25f,-0.25f));		// Left Of Triangle (Bottom)
		colors.push_back(Vector3(1.0f,1.0f,0.0f));
		vertices.push_back(Vector3(0.25f,-0.25f, 0.25f));		// Right Of Triangle (Bottom)

		colors.push_back(Vector3(1.0f,1.0f,0.0f));			// Set The Color To Yeller
		vertices.push_back(Vector3(0.25f, -0.25f, 0.25f));			// Top Of Triangle (Bottom)
		colors.push_back(Vector3(1.0f,1.0f,0.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f,0.25f));		// Left Of Triangle (Bottom)
		colors.push_back(Vector3(1.0f,1.0f,0.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f, -0.25f));		// Right Of Triangle (Bottom)
	} 
	// Set to draw a cube
	else if(type == CUBE) {
		colors.push_back(Vector3(0.0f,1.0f,0.0f));			// Set The Color To Green
		vertices.push_back(Vector3( 0.25f, 0.25f,-0.25f));			// Top Right Of The Quad (Top)
		colors.push_back(Vector3(0.0f,1.0f,0.0f));
		vertices.push_back(Vector3(-0.25f, 0.25f,-0.25f));			// Top Left Of The Quad (Top)
		colors.push_back(Vector3(0.0f,1.0f,0.0f));
		vertices.push_back(Vector3(-0.25f, 0.25f, 0.25f));			// Bottom Left Of The Quad (Top)
		colors.push_back(Vector3(0.0f,1.0f,0.0f));
		vertices.push_back(Vector3( 0.25f, 0.25f, 0.25f));			// Bottom Right Of The Quad (Top)

		colors.push_back(Vector3(1.0f,0.5f,0.0f));			// Set The Color To Orange
		vertices.push_back(Vector3( 0.25f,-0.25f, 0.25f));			// Top Right Of The Quad (Bottom)
		colors.push_back(Vector3(1.0f,0.5f,0.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f, 0.25f));			// Top Left Of The Quad (Bottom)
		colors.push_back(Vector3(1.0f,0.5f,0.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f,-0.25f));			// Bottom Left Of The Quad (Bottom)
		colors.push_back(Vector3(1.0f,0.5f,0.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f,-0.25f));			// Bottom Right Of The Quad (Bottom)

		colors.push_back(Vector3(1.0f,0.0f,0.0f));			// Set The Color To Red
		vertices.push_back(Vector3( 0.25f, 0.25f, 0.25f));			// Top Right Of The Quad (Front)
		colors.push_back(Vector3(1.0f,0.0f,0.0f));
		vertices.push_back(Vector3(-0.25f, 0.25f, 0.25f));			// Top Left Of The Quad (Front)
		colors.push_back(Vector3(1.0f,0.0f,0.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f, 0.25f));			// Bottom Left Of The Quad (Front)
		colors.push_back(Vector3(1.0f,0.0f,0.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f, 0.25f));			// Bottom Right Of The Quad (Front)

		colors.push_back(Vector3(1.0f,1.0f,0.0f));			// Set The Color To Yellow
		vertices.push_back(Vector3( 0.25f,-0.25f,-0.25f));			// Bottom Left Of The Quad (Back)
		colors.push_back(Vector3(1.0f,1.0f,0.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f,-0.25f));			// Bottom Right Of The Quad (Back)
		colors.push_back(Vector3(1.0f,1.0f,0.0f));
		vertices.push_back(Vector3(-0.25f, 0.25f,-0.25f));			// Top Right Of The Quad (Back)
		colors.push_back(Vector3(1.0f,1.0f,0.0f));
		vertices.push_back(Vector3( 0.25f, 0.25f,-0.25f));			// Top Left Of The Quad (Back)

		colors.push_back(Vector3(0.0f,0.0f,1.0f));			// Set The Color To Blue
		vertices.push_back(Vector3(-0.25f, 0.25f, 0.25f));			// Top Right Of The Quad (Left)
		colors.push_back(Vector3(0.0f,0.0f,1.0f));
		vertices.push_back(Vector3(-0.25f, 0.25f,-0.25f));			// Top Left Of The Quad (Left)
		colors.push_back(Vector3(0.0f,0.0f,1.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f,-0.25f));			// Bottom Left Of The Quad (Left)
		colors.push_back(Vector3(0.0f,0.0f,1.0f));
		vertices.push_back(Vector3(-0.25f,-0.25f, 0.25f));			// Bottom Right Of The Quad (Left)

		colors.push_back(Vector3(1.0f,0.0f,1.0f));			// Set The Color To Violet
		vertices.push_back(Vector3( 0.25f, 0.25f,-0.25f));			// Top Right Of The Quad (Right)
		colors.push_back(Vector3(1.0f,0.0f,1.0f));
		vertices.push_back(Vector3( 0.25f, 0.25f, 0.25f));			// Top Left Of The Quad (Right)
		colors.push_back(Vector3(1.0f,0.0f,1.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f, 0.25f));			// Bottom Left Of The Quad (Right)
		colors.push_back(Vector3(1.0f,0.0f,1.0f));
		vertices.push_back(Vector3( 0.25f,-0.25f,-0.25f));			// Bottom Right Of The Quad (Right)
	}
}

// Destructor
Mesh::~Mesh(void) {
	// Do nothing
}